<template>
  <h1>子组件222</h1>
  <div>{{ message }}</div>
  <button @click="sendMessage">给父组件发消息</button>
</template>

<script setup>
const emit = defineEmits(['message-sent']);
function sendMessage() {
  emit('message-sent', '来自子组件的消息');
}

defineProps({
  message: String,
});
</script>